﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Xml;

namespace DAO
{
    public class DataProvider
    {
        public static String ConnectionString
        {
            get
            {
                return ReadConnectionString("data//ketnoicsdl.xml");
            }
        }
        public static String ReadConnectionString(String file)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(file);
                XmlElement root = doc.DocumentElement;
                String connectionString = root.InnerText;
                return connectionString;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public static OleDbConnection ConnectDB()
        {
            string connectionString = ConnectionString;
            OleDbConnection conn;
            conn = new OleDbConnection(connectionString);
            conn.Open();
            return conn;
        }

    }
}
